The Array.isArray() method is used to determine whether a given value is an array. It returns true if the value is an array, and false otherwise.
You receive a JSON payload where a field might be a single object or an array of objects. How would you use Array.isArray to handle both cases safely?
What does Array.isArray([]) return and why?
If you call Array.isArray on a string value, what result do you get?
Your team replaced a custom check (typeof value === 'object') with Array.isArray and a bug disappeared. Explain why the original check was insufficient.
During debugging you see a NodeList being passed to a function that expects an array, causing .map to fail. How would you detect and convert it safely?
When merging API responses you sometimes get undefined instead of an array. Show how you’d guard the concatenation using Array.isArray.
In a high‑throughput data pipeline you need to verify that incoming fields are arrays. Discuss the performance impact of using Array.isArray versus other checks at scale and any optimization you’d consider.
You’re designing a shared library function that accepts either a single item or an array of items. How would you structure its API and internal validation with Array.isArray to keep it robust across services?
Your code runs in both Node and browser bundles. Explain how reliance on Array.isArray affects bundle size and tree‑shaking, and whether any alternatives are viable.
Your organization is migrating legacy code that uses custom isArray helpers to a new TypeScript codebase. Outline a migration plan that replaces those helpers with Array.isArray, covering backward compatibility, testing, and cross‑team coordination.
You need to enforce a contract across multiple microservices that certain payload fields must be arrays. How would you standardize validation using Array.isArray while keeping services loosely coupled?
When building a schema‑validation framework that runs in Node, Deno, and browsers, discuss how you’d abstract array detection and why you’d still choose Array.isArray as the canonical check.